// require FileSaver.min.js
if (!saveAs) alert('require FileSaver.min.js');
// PID - parent node id
function saveSvgByPID(parentId) {
    var svgxml = document.querySelector('#' + parentId).innerHTML;
    svgxml = '<?xml version="1.0" encoding="UTF-8" ?>' + "\n" + '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">' + svgxml;
    var blob = new Blob([svgxml], { type: 'image/svg+xml;charset=utf-8' });
    saveAs(blob, "tmp.svg");
}